package com.ljy.my_study.thread;
/** 
* @author James
* @date 2019年5月3日 
*/
public class ThreadLocalMain {
	
	static ThreadLocal<String> mainT=new ThreadLocal<>();
	
	public static void main(String[] args) throws InterruptedException {
		AThreadLocalTest a=new AThreadLocalTest();
		a.setValue(Thread.currentThread().getName());
		System.out.println(a.getValue());
		mainT.set("mainT:"+Thread.currentThread().getName());
		System.out.println(mainT.get());
		Thread t=new Thread() {
			@Override
			public void run() {
				a.setValue(Thread.currentThread().getName());
				mainT.set("mainT:"+Thread.currentThread().getName());
				System.out.println(a.getValue());
				System.out.println(mainT.get());
			}
		};
		t.start();
		t.join();
		System.out.println(a.getValue());
	}
}
